package com.caiyouxi.goods.controller;


import com.caiyouxi.common.bean.ResData;
import com.caiyouxi.common.control.BaseController;
import com.caiyouxi.goods.model.GoodsCategory;
import com.caiyouxi.goods.service.GoodsCategoryService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * Created by Administrator on 2017/11/8.
 */

@RestController
@RequestMapping("/boss/goods_category")
public class GoodsCategoryController extends BaseController {


    private Logger logger = Logger.getLogger(GoodsCategoryController.class);

    @Autowired
    private GoodsCategoryService goodsCategoryService;

    /**
     * 查询商品品类
     */
    @RequestMapping("get_goods_category_info")
    public ResData get_goods_category_info(HttpServletRequest request,HttpServletResponse response, @RequestBody GoodsCategory goodsCategory){
        logger.info("=============================== 查询商品品类 ================================");
        return goodsCategoryService.get_goods_category_info(goodsCategory);
    }

    /**
     * 查询商品品类列表
     */
    @RequestMapping("/get_goods_category_list")
    public ResData get_goods_category_list(HttpServletRequest request,HttpServletResponse response,@RequestBody GoodsCategory goodsCategory){
        logger.info("=============================== 查询商品品类列表================================");
        return goodsCategoryService.get_goods_category_list(goodsCategory);
    }

    /**
     * 新增商品品类
     */
    @RequestMapping("add_goods_category")
    public ResData insert_goods_category(HttpServletRequest request,HttpServletResponse response,@RequestBody GoodsCategory goodsCategory){
        logger.info("=============================== 新增商品品类 ================================");
        return goodsCategoryService.add_goods_category(goodsCategory);
    }

    /**
     * 修改商品品类
     */
    @RequestMapping("update_goods_category")
    public ResData update_goods_category(HttpServletRequest request,HttpServletResponse response,@RequestBody GoodsCategory goodsCategory){
        logger.info("=============================== 修改商品品类 ================================");
        return  goodsCategoryService.update_goods_category(goodsCategory);
    }

    /**
     * 删除商品品类
     */
    @RequestMapping("delete_goods_category")
    public ResData delete_goods_category(HttpServletRequest request,HttpServletResponse response,@RequestBody GoodsCategory goodsCategory){
        logger.info("=============================== 删除商品品类 ================================");
        return goodsCategoryService.delete_goods_category(goodsCategory) ;
    }


}
